<template>
	<view class="mechanismWorking">
		<view class="mechanismWorking-header">
			<view class="mechanismWorking-header-box ff-border-radius-10 ff-bg-fff">
				<view class="ff-font-16 ff-font-weight-600 ff-color-000 ff-margin-bottom-5 ff-line-height-1-3">
					{{ assessmentDetails.assessName }}
				</view>
				<view class="ff-align-items-one ff-flex-wrap">
					<view class="ff-margin-right-10">
						<view v-if="assessmentDetails.assessStatus == 2" class="tips1 ff-font-12">评估状态&nbsp;|&nbsp;已响应
						</view>
						<view v-if="assessmentDetails.assessStatus == 3" class="tips1 ff-font-12">评估状态&nbsp;|&nbsp;待指派
						</view>
						<view v-if="assessmentDetails.assessStatus == 11" class="tips1 ff-font-12">评估状态&nbsp;|&nbsp;待评估
						</view>
						<view v-if="assessmentDetails.assessStatus == 4" class="tips1 ff-font-12">评估状态&nbsp;|&nbsp;评估中
						</view>
						<view v-if="assessmentDetails.assessStatus == 5" class="tips1 ff-font-12">评估状态&nbsp;|&nbsp;待提交
						</view>
						<view v-if="assessmentDetails.assessStatus == 6" class="tips1 ff-font-12">评估状态&nbsp;|&nbsp;待审核
						</view>
						<view v-if="assessmentDetails.assessStatus == 7" class="tips1 ff-font-12">评估状态&nbsp;|&nbsp;待签发
						</view>
						<view v-if="assessmentDetails.assessStatus == 8" class="tips1 ff-font-12">评估状态&nbsp;|&nbsp;已驳回
						</view>
						<view v-if="assessmentDetails.assessStatus == 9" class="tips1 ff-font-12">评估状态&nbsp;|&nbsp;已完成
						</view>
						<view v-if="assessmentDetails.assessStatus == 10" class="tips5 ff-font-12">评估状态&nbsp;|&nbsp;已解约
						</view>
					</view>
					<view v-if="assessmentDetails.rescissionStatus == 1"
						class="tips4 ff-color-fff ff-font-12 ff-margin-right-10">解约确认中</view>
				</view>
				<view class="ff-font-13 mechanismWorking-header-box-address ff-line-height-1-3 ff-flex">
					<view>社会单位：</view>
					<view>{{ assessmentDetails.companyName }}</view>
				</view>
				<view class="ff-font-13 mechanismWorking-header-box-address ff-line-height-1-3 ff-flex">
					<view>项目地址 ：</view>
					<view>{{ assessmentDetails.assessAddr }}</view>
				</view>
				<view
					class="mechanismWorking-header-box-butList ff-flex-between ff-font-13 ff-color-blue ff-margin-top-13">
					<view class="buts" @click.stop="projectDetailsClick">项目详情</view>
				</view>
			</view>
			<view class="mechanismWorking-content ff-font-14 ff-padding-bottom-230">
				<view
					class="mechanismWorking-content-info-box ff-padding-12 ff-bg-fff ff-border-radius-10 ff-margin-top-12">
					<view
						class="mechanismWorking-content-info-box-title ff-font-16 ff-font-weight-600 ff-color-5C5F65 ff-border-radius-5">
						评估人员</view>
					<view class="ff-flex ff-padding-left-5 ff-margin-bottom-16">
						<view class="mechanismWorking-content-info-box-content-left">项目负责人</view>
						<view class="mechanismWorking-content-info-box-content-right">
							<view v-for="(item, index) of assessmentDetails.leaders" :key="index">
								{{ item.projectLeaderName }}&nbsp;{{ item.projectLeaderPhone }}
							</view>
						</view>
					</view>
					<view class="ff-flex ff-padding-left-5 ff-margin-bottom-16">
						<view class="mechanismWorking-content-info-box-content-left">项目成员</view>
						<view class="mechanismWorking-content-info-box-content-right">
							<view class="ff-margin-bottom-5" v-for="(item, index) of assessmentDetails.operators"
								:key="index">
								{{ item.projectOperatorName }}&nbsp;{{ item.projectOperatorPhone }}
							</view>
						</view>
					</view>
				</view>
				<view
					class="mechanismWorking-content-info-box ff-padding-12 ff-bg-fff ff-border-radius-10 ff-margin-top-12">
					<view
						class="mechanismWorking-content-info-box-title ff-font-16 ff-font-weight-600 ff-color-5C5F65 ff-border-radius-5">
						评估依据</view>
					<view class="ff-flex-wrap">
						<view class="ff-margin-right-10 ff-margin-bottom-10"
							v-for="(item, index) of assessmentDetails.basis" :key="index">
							<u-tag
								:text="`${index + 1}. ${item.legalDocumentNumber == null ? '' : item.legalDocumentNumber} ${item.legalBasisName}`" />
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="mechanismWorking-operation">
			<view class="ff-padding-10 ff-flex-between">
				<view class="ff-color-3D4060 ff-font-weight-600 ff-font-15 mechanismWorking-operation-endBut"
					@click.stop="endassessmentClick">结束执业</view>
				<view class="ff-align-items-one">
					<view v-if="true" class="mechanismWorking-operation-location ff-margin-right-18"
						@click.stop="refreshClick">
						<image src="https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/refresh.png"
							mode="">
						</image>
					</view>
					<view v-if="false" class="mechanismWorking-operation-location" @click.stop="punchPositionClick">
						<image src="https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/location.png"
							mode="">
						</image>
					</view>
				</view>
			</view>
			<view class="ff-bg-e9effd">
				<view class="mechanismWorking-operation-info ff-align-items-one ff-flex-between ff-font-13"
					v-if="false">
					<view class="ff-align-items-one">
						<image v-if="assessmentDetails.workingNum"
							src="https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/assessment-people.png"
							mode=""></image>
						<view v-if="assessmentDetails.workingNum">{{ assessmentDetails.workingNum }}人正在执业</view>
					</view>
					<view class="ff-line-height-1-3 ff-text-right finishTime">预计完成时间: {{ assessmentDetails.endTime }}
					</view>
				</view>
				<view class="mechanismWorking-operation-card ff-margin-10 ff-align-items-one ff-flex-between">
					<view class="ff-font-12">
						<view>
							<view class="ff-align-items-one ff-margin-bottom-8" v-if="practiceInfo.needTimeFmt">
								<view>所需工时：</view>
								<view>
									<text class="ff-color-fff ff-margin-right-5">{{ practiceInfo.needTimeFmt }}</text>
								</view>
							</view>
							<view class="ff-align-items-one ff-margin-bottom-8" v-if="practiceInfo.passTimeFmt">
								<view>完成工时：</view>
								<view>
									<text class="ff-color-fff ff-margin-right-5">{{ practiceInfo.passTimeFmt }}</text>
								</view>
							</view>
							<view class="ff-align-items-one" v-if="practiceInfo.remainingTimeFmt">
								<view>剩余工时：</view>
								<view>
									<text
										class="ff-color-fff ff-margin-right-5">{{ practiceInfo.remainingTimeFmt }}</text>
								</view>
							</view>
						</view>
					</view>
					<view class="ff-flex">
						<view v-if="!practiceState" class="ff-align-items-one mechanismWorking-operation-card-start"
							@click.stop="practiceClick(1)">
							<u-icon name="play-right-fill" color="#fff" size="30"></u-icon>
							<view class="ff-margin-left-5 ff-font-14 ff-color-fff">开始执业</view>
						</view>
						<view v-else class="ff-align-items-one mechanismWorking-operation-card-suspend"
							@click.stop="practiceClick(2)">
							<u-icon name="pause" color="#fff" size="30"></u-icon>
							<view class="ff-font-14 ff-margin-left-5 ff-color-fff">暂停执业</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 组件区 -->
		<u-toast ref="uToast" />
		<f-loading ref="loading" />
		<u-modal v-model="locationModal" title="温馨提示" :content-style="{ 'line-height': '1.5' }"
			content="获取小程序openid失败！" />
		<u-modal v-model="deleteImgModal" @confirm="deleteImgConfirm" :show-cancel-button="true" title="温馨提示"
			:content-style="{ 'line-height': '1.5' }" content="您确定要删除这张照片吗？" />
		<u-modal v-model="deleteFacilitiesModal" @confirm="deleteFacilitiesConfirm" :show-cancel-button="true"
			title="温馨提示" :content-style="{ 'line-height': '1.5' }" :content="deleteFacilitiesContent" />
		<u-modal v-model="tipsModal" title="温馨提示" :content-style="{ 'line-height': '1.5' }" :content="tipsContent" />
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import config from '@/tools/config.js';
	export default {
		name: 'mechanismWorking',
		data() {
			return {
				tipsModal: false, // 提示弹窗显/隐
				tipsContent: '', // 提示弹窗具体内容
				assessId: '', // 评估id
				assessmentDetails: {}, // 评估详情（所有的数据，包括消防设施和图片）
				practiceInfo: {}, // 执业信息
				practiceState: false, // 是否开启执业, 当前执业状态: 1.进行中  2.已暂停  3.作废
				// 人脸识别相关
				faceInfo: {
					faceState: '', // 评估状态（1开始，2暂停，3结束）
					latitude: '', // 纬度
					longitude: '', // 经度
					accessToken: '', // 百度accesstoken
					sessionCode: '', // 用户需要大声读出数字
					videoPath: '', // 上传视频后返回的临时视频路径
					videoBase64: '', // 视频base64
					imageBase64: '' // 图片base64
				},
				assessmentParams: {} // 开始or暂停评估请求的参数
			};
		},
		onLoad(e) {
			// console.log('前页面传过来的数据------', e);
			this.assessId = e.assessId;
			this.getAssessmentDetails(e.assessId); // 获取评估详情数据
			this.getAssessmentNeedTimeToEnd(e.assessId); // 获取工时等数据
		},
		computed: {
			...mapState({
				configInfo: modules => modules.infoList.configInfo,
				userInfo: modules => modules.infoList.userInfo
			})
		},
		methods: {
			//-----------------------------数据加载区----------------------------
			// 获取评估详情
			async getAssessmentDetails(assessId) {
				this.$refs.loading.openLoading('加载中···');
				const data = await this.$http.post({
					url: `/bsAssessProjectInfo/detail`,
					data: {
						assessId: assessId
					}
				});
				// console.log('获取评估详情页数据------', data);
				if (data.code == 200) {
					this.$refs.loading.closeLoading();
					this.assessmentDetails = data.data;
					this.getOpenPractice(); // 获取是否开启执业
				} else {
					this.$refs.loading.closeLoading();
					this.$refs.uToast.show({
						title: data.msg,
						type: 'error'
					});
				}
			},
			// 获取工时等数据
			async getAssessmentNeedTimeToEnd(assessId) {
				this.$refs.loading.openLoading('加载中···');
				const data = await this.$http.get({
					url: `/bsAssessProjectInfo/getNeedTimeToEnd/${assessId}`
				});
				// console.log('获取获取工时等数据------', data);
				if (data.code == 200) {
					this.practiceInfo = data.data;
				} else {
					this.$refs.uToast.show({
						title: data.msg,
						type: 'error'
					});
				}
				this.$refs.loading.closeLoading();
			},
			// 获取是否开启执业
			async getOpenPractice() {
				this.$refs.loading.openLoading('加载中···');
				const data = await this.$http
					.post({
						url: `/bsAssessProjectInfo/getCurrentPractice/${this.assessmentDetails.assessId}`
					});
				// console.log('获取是否开启执业------', data);
				if (data.code == 200 && data.data) {
					let info = data.data;
					// 当前执业状态: 1.进行中  2.已暂停  3.作废
					if (info.status == 1) {
						this.practiceState = true;
					} else if (info.status == 2 || info.status == 3) {
						this.practiceState = false;
					}
				}
				this.$refs.loading.closeLoading();
			},
			// -------------跳转系列-----------------------
			// 点击进入项目详情
			projectDetailsClick() {
				this.$pageJump.navigateTo('/pages/assessment/common/square/components/demandDetails?id=' + this
					.assessmentDetails.assessId);
			},
			// 点击刷新页面
			refreshClick() {
				this.getAssessmentNeedTimeToEnd(this.assessId); // 获取工时等数据
				this.getAssessmentDetails(this.assessId); // 获取评估详情（所有的数据，包括消防设施和图片）
			},
			//------------------------业务区------------------------------------------
			// ---------------------------------刷脸系列操作--------------------------------------------业务
			// 开启执业or暂停执业-------第一步 定位
			practiceClick(type) {
				let that = this;
				let setDistance = this.configInfo.faceRecognitionRange || config.location_distance; // 后台限制刷脸的范围
				uni.getLocation({
					type: 'gcj02',
					geocode: true,
					success: function(res) {
						// console.log('当前定位-----项目定位', res, that.assessmentDetails.assessLatitude, that.assessmentDetails.assessLongitude)
						that.faceInfo.latitude = res.latitude;
						that.faceInfo.longitude = res.longitude;
						let distance = that.$check.getDistance(that.assessmentDetails.assessLatitude, that
							.assessmentDetails.assessLongitude, res.latitude, res.longitude);
						if (parseFloat(distance) * 1000 <= setDistance * 10) {
							// 开启执业
							if (type == 1) {
								that.faceInfo.faceState = 1; // 开始评估
								that.checkFaceClick(); // 刷脸前的校验
								return;
							}
							// 暂停执业
							if (type == 2) {
								if (that.userInfo.id == that.assessmentDetails.leaders[0].userId) {
									uni.showModal({
										title: '是否暂停执业？',
										content: '项目负责人暂停执业后，本项目的有效工时也暂停计算。',
										confirmColor: '#3178FF',
										cancelColor: '#606266',
										success: res => {
											if (res.confirm) {
												that.faceInfo.faceState = 2; // 暂停评估
												that.faceCertificationOne(); // 开启刷脸
											}
										}
									});
								} else {
									that.faceInfo.faceState = 2; // 暂停评估
									that.faceCertificationOne(); // 开启刷脸
								}
								return;
							}
						} else {
							that.tipsContent = `您距离项目所在地中心点超过${setDistance}米, 请先到评估地点后再定位！`;
							that.tipsModal = true;
						}
					},
					fail() {
						that.tipsContent = '当前位置获取失败，请您开启GPS定位权限后再试！';
						that.tipsModal = true;
					}
				});
			},
			// 刷脸前的校验
			async checkFaceClick() {
				let that = this
				that.$refs.loading.openLoading('校验中···');
				const data = await that.$http.post({
					url: '/bsAssessProjectInfo/checkForPractice',
					data: {
						assessId: that.assessId,
					}
				});
				// console.log('刷脸前的校验------', data);
				if (data.code == 200) {
					if (data.data.status == 0) {
						that.faceCertificationOne(); // 开启刷脸
					} else if (data.data.status == 1) {
						uni.showModal({
							title: '温馨提示',
							content: data.data.msg,
							confirmColor: '#3178FF',
							showCancel: true,
							success: function(res) {
								if (res.confirm) {
									that.faceCertificationOne(); // 开启刷脸
								} else {
									that.refreshClick(); // 重新刷新页面
								}
							},
						})
					}
				} else {
					that.maskBoxState = false
					that.tipsContent = data.msg;
					that.tipsModal = true;
					that.refreshClick() // 刷新数据
				}
				that.$refs.loading.closeLoading();
			},
			// 开启刷脸---第一步（录视频）
			faceCertificationOne() {
				let that = this;
				uni.showModal({
					title: '录制活体人脸视频警告',
					content: '为了保障人脸识别的准确性，在视频录制过程中，请将面部正对手机摄像头，并大声读出：消防技术服务。',
					confirmText: '开始认证',
					confirmColor: '#3178FF',
					cancelColor: '#606266',
					success: function(res) {
						if (res.confirm) {
							uni.chooseVideo({
								count: 1,
								compressed: true,
								sourceType: ['camera'],
								camera: 'front',
								maxDuration: 5,
								success(res) {
									that.$refs.loading.openLoading('视频解析中···');
									that.faceInfo.videoPath = res.tempFilePath;
									uni.getFileSystemManager().readFile({
										filePath: that.faceInfo.videoPath,
										encoding: 'base64', //编码格式
										success: res => {
											that.faceInfo.videoBase64 = res.data;
											that.$refs.loading.openLoading('视频分析中···');
											let videoData = {
												video: that.faceInfo.videoBase64,
												id: that.assessId,
												type: 2 // 1维保2评估3检测
											};
											that.$http
												.post({
													url: '/maintenance/cutVideoV5',
													data: videoData
												})
												.then(res => {
													if (res.code == 200 && res
														.success) {
														// console.log('后台视频分析返回----', res.data);
														if (res.data.length != 0) {
															that.faceInfo.imageBase64 =
																res.data[Math.floor((
																	Math
																	.random() *
																	res.data
																	.length))];
															that
																.faceCertificationTwo(); // 调用百度库，进行人脸检测
														} else {
															that.$refs.loading
																.closeLoading();
															that.tipsContent =
																'人脸活体视频解析失败, 请重新操作！';
															that.tipsModal = true;
														}
													} else {
														that.$refs.loading
															.closeLoading();
														that.tipsContent = res.msg;
														that.tipsModal = true;
													}
												});
										},
										fail: res => {
											that.$refs.loading.closeLoading();
											that.tipsContent = '人脸活体视频解析失败, 请重新操作！';
											that.tipsModal = true;
										}
									});
								},
								fail(res) {
									that.$refs.loading.closeLoading();
									that.tipsContent = '人脸活体视频解析失败, 请重新操作！';
									that.tipsModal = true;
								}
							});
						}
					}
				});
			},
			// 开启刷脸---第二步（调用百度库，进行人脸检测）
			faceCertificationTwo() {
				let that = this;
				that.$refs.loading.openLoading('活体检测中，请稍候');
				uni.request({
					url: 'https://aip.baidubce.com/oauth/2.0/token', //是真实的接口地址
					data: {
						grant_type: config.baidu_grant_type,
						client_id: config.baidu_client_id, //用你创建的应用的API Key
						client_secret: config.baidu_client_secret //用你创建的应用的Secret Key
					},
					header: {
						'Content-Type': 'application/json'
					},
					success(res) {
						// console.log('获取token---', res);
						that.faceInfo.accessToken = res.data.access_token; //获取到token
						// 活体检测
						uni.request({
							url: 'https://aip.baidubce.com/rest/2.0/face/v3/faceverify?access_token=' + res
								.data
								.access_token,
							method: 'POST',
							data: [{
								image: that.faceInfo.imageBase64,
								image_type: 'BASE64'
							}],
							header: {
								'Content-Type': 'application/json'
							},
							success(res) {
								// console.log('活体检测返回数据---------', res);
								if (res.data.error_code == 0 && res.data.result.face_liveness >= 0.8) {
									// 人脸库搜索
									that.$refs.loading.openLoading('人脸识别中，请稍候');
									uni.request({
										url: 'https://aip.baidubce.com/rest/2.0/face/v3/search?access_token=' +
											that.faceInfo.accessToken,
										method: 'POST',
										data: {
											image: that.faceInfo.imageBase64,
											image_type: 'BASE64',
											group_id_list: config.baidu_group_id,
											liveness_control: 'NORMAL', // 活体检测控制NONE: 不进行控制LOW:较低的活体要求(高通过率 低攻击拒绝率)NORMAL: 一般的活体要求(平衡的攻击拒绝率, 通过率)HIGH: 较高的活体要求(高攻击拒绝率 低通过率)默认NONE若活体检测结果不满足要求，则返回结果中会提示活体检测失败
											user_id: config.baidu_userid_pre + that.userInfo
												.userIdCard
										},
										header: {
											'Content-Type': 'application/json'
										},
										success(res) {
											// console.log('上传人脸检测返回数据-------------', res);
											if (
												res.data.error_msg == 'SUCCESS' &&
												res.data.result.user_list[0].user_id == config
												.baidu_userid_pre +
												that.userInfo.userIdCard &&
												res.data.result.user_list[0].score > 80
											) {
												that.$refs.loading.closeLoading();
												if (that.faceInfo.faceState == 1 || that.faceInfo
													.faceState == 2) {
													that.handleassessment(); // 开始评估 or 暂停评估
												} else if (that.faceInfo.faceState == 3) {
													that.endHandleassessment(); // 结束评估
												}

											} else {
												that.$refs.loading.closeLoading();
												if (res.data.error_code == '222207') {
													uni.showModal({
														title: '认证失败',
														confirmColor: '#3178FF',
														showCancel: false,
														content: '为了提升消防服务执业的效率，消防小程序将进行一次全面的升级。请依次点击【我的】-【比对公安人证信息】进行操作。感谢您的配合！',
														success: function() {}
													});
												} else {
													that.$refs.loading.closeLoading();
													that.tipsContent = '请所属帐号本人认证！';
													that.tipsModal = true;
												}
											}
										},
										fail() {
											that.$refs.loading.closeLoading();
											that.tipsContent = '出现错误，人脸对比系统异常！';
											that.tipsModal = true;
										}
									});
								} else {
									that.$refs.loading.closeLoading();
									that.tipsContent = '请确保是本人操作！';
									that.tipsModal = true;
								}
							}
						});
					},
					fail() {
						that.$refs.loading.closeLoading();
						that.tipsContent = '出现错误，ai获取token系统异常！';
						that.tipsModal = true;
					}
				});
			},
			// 开始评估or暂停评估------操作
			async handleassessment() {
				let that = this;
				that.$refs.loading.openLoading(that.faceInfo.faceState == 1 ? '开启评估中···' : '暂停评估中···'); // 打开loading动画
				let filePath = wx.env.USER_DATA_PATH + '/hym_pay_qrcode.png';
				uni.getFileSystemManager().writeFile({
					filePath: filePath, //创建一个临时文件名
					data: that.faceInfo.imageBase64, //写入的文本或二进制数据
					encoding: 'base64', //写入当前文件的字符编码
					success: res => {
						that.$uploadImg.uploadImgOSSBase64(filePath, 4).then(resPortrait => {
							if (resPortrait != null && resPortrait.length > 0) {
								if (that.faceInfo.faceState == 1) {
									this.assessmentParams = {
										assessId: that.assessmentDetails.assessId, // 评估记录ID
										startLatitude: that.faceInfo.latitude, // 评估开始纬度
										startLongitude: that.faceInfo.longitude, // 评估开始经度
										startFaceUrl: resPortrait // 执业人脸认证头像
									};
								} else {
									this.assessmentParams = {
										assessId: that.assessmentDetails.assessId, // 评估记录ID
										endLatitude: that.faceInfo.latitude, // 评估结束纬度
										endLongitude: that.faceInfo.longitude, // 评估结束经度
										endFaceUrl: resPortrait // 执业人脸认证头像
									};
								}

								this.$http
									.post({
										url: that.faceInfo.faceState == 1 ?
											'/bsAssessProjectInfo/startPractice' :
											'/bsAssessProjectInfo/endPractice',
										data: this.assessmentParams
									})
									.then(res => {
										// console.log('执业返回的结果-------------', res);
										that.$refs.loading.closeLoading();
										if (res.code == 200 && res.success) {
											if (that.faceInfo.faceState == 1) {
												if (res.data.status == 1) {
													that.tipsContent = res.data.msg
													that.tipsModal = true;
												}
												that.tipsContent =
													'开始评估成功！请注意：项目负责人与至少1位执业人员打卡后，才计算有效工时。';
												that.tipsModal = true;
												that.refreshClick(); // 重新刷新页面
											} else if (that.faceInfo.faceState == 2) {
												that.tipsContent = '暂停评估成功！';
												that.tipsModal = true;
												that.refreshClick(); // 重新刷新页面
												return;
											}
										} else {
											that.tipsContent = res.msg;
											that.tipsModal = true;
										}
									});
							} else {
								that.$refs.loading.closeLoading();
								that.tipsContent = '人脸上传失败，请检查网络是否正常！';
								that.tipsModal = true;
							}
						});
					},
					fail: err => {
						that.$refs.loading.closeLoading();
						// console.log('开始评估发生错误-----', err);
					}
				});
			},
			// 结束执业--------操作
			endassessmentClick() {
				let that = this;
				if (that.assessmentDetails.canEnd == null || that.assessmentDetails.canEnd == 2) {
					that.tipsContent = '当前无法结束执业！';
					that.tipsModal = true;
					return;
				}
				uni.showModal({
					title: '温馨提示',
					content: '是否结束现场执业？',
					confirmColor: '#3178FF',
					cancelColor: '#606266',
					success: res => {
						if (res.confirm) {
							that.faceInfo.faceState = 3; // 结束评估
							that.faceCertificationOne(); // 开启刷脸
						}
					}
				});
			},
			// 结束执业----第二步
			async endHandleassessment() {
				this.$refs.loading.openLoading('结束评估中···');
				const data = await this.$http.get({
					url: `/bsAssessProjectInfo/${this.assessmentDetails.assessId}/end`
				});
				if (data.code == 200 && data.success) {
					this.tipsContent = '结束评估成功！';
					this.tipsModal = true;
					this.$pageJump.reLaunch(
						'/pages/assessment/mechanism/home/components/mechanismWork/components/mechanismResults?id=' +
						this.assessmentDetails.assessId +
						'&operators=' +
						JSON.stringify(this.assessmentDetails.operators)
					);
				} else {
					this.tipsContent = data.msg;
					this.tipsModal = true;
				}
				this.$refs.loading.closeLoading();
			}
		},
		onShareAppMessage() {
			return {
				title: '分享小程序给朋友',
				path: '/pages/homePage/Home'
			};
		}
	};
</script>

<style lang="scss">
	.mechanismWorking {
		.u-size-default {
			height: auto !important;
		}
	}
</style>
<style lang="scss" scoped>
	@import './components/mechanismWorking.scss';

	.tips4 {
		margin-top: 0 !important;
	}
</style>